﻿using Microsoft.Extensions.Primitives;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zocono.WCS.Infrastructure.ApllicationDto.DtoWcsManage
{
    public class InterfaceLogInfoDto : PageResultDto
    {
        public long ILogId { get; set; }

        public string Js_ID { get { return ILogId.ToString(); } }

        /// <summary>
        /// Desc:接口地址(URL)
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string InterfaceUrl { get; set; }

        /// <summary>
        /// Desc:方法名称
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string ActionName { get; set; }

        /// <summary>
        /// Desc:IP地址
        /// Default:
        /// Nullable:False
        /// </summary>           
        //public string IpAddress { get; set; }

        /// <summary>
        /// Desc:请求参数
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string InterfacePara { get; set; }

        /// <summary>
        /// Desc:响应结果
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string InterfaceResult { get; set; }

        /// <summary>
        /// Desc:是否成功
        /// Default:
        /// Nullable:False
        /// </summary>           
        public bool IsSuccess { get; set; }

        /// <summary>
        /// Desc:开始时间
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime StartTime { get; set; }

        /// <summary>
        /// Desc:结束时间
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime EndTime { get; set; }

        /// <summary>
        /// Desc:描述
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string Description { get; set; }

        /// <summary>
        /// Desc:创建时间
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime CreateTime { get; set; }


        private const string DATE_STRING_FORMAT = "yyyy-MM-dd HH:mm:ss";
        private readonly DateTime defaultTime = new DateTime(1900, 1, 1);

        public string CreateTimeFormat
        {
            get
            {
                if (CreateTime <= defaultTime)
                {
                    return "";
                }

                return CreateTime.ToString(DATE_STRING_FORMAT);
            }
        }

        public string start { get; set; }
        public string end { get; set; }
    }
}
